class ProjectsController < ApplicationController
  active_scaffold do |config|
    config.columns = :name, :project_type, :components, :created_at
    create.columns.exclude :components
    update.columns.exclude :components

    #list.columns.exclude :nil
    #create.columns.exclude :nil
    #update.columns.exclude :nil
    #show.columns.exclude :nil

    config.list.sorting = { :name => :desc }

    action_links.add "下载", :type => :record, :action => 'download', :popup => true

    columns[:project_type].clear_link
    columns[:project_type].form_ui = :select
  end

  def download
    @project = Project.find(params[:id])
    redirect_to "#{@project.project_url_root}/#{File.basename(@project.generate_zip)}"
  end

  # active_scaffold callbacks
  def conditions_for_collection()
  end

  def before_create_save(record)
  end

  def after_create_save(record)
  end
  
  def before_update_save(record)
  end

  def after_update_save(record)
  end
end
